package net.siufung.market.base.permit.config;

import lombok.AllArgsConstructor;
import net.siufung.market.base.app.spi.ICheckMenuOccupySpi;
import net.siufung.market.base.app.spi.IUpdateMenuSpi;
import net.siufung.market.base.permit.mapper.IMenuMapper;
import net.siufung.market.base.permit.provider.CheckMenuOccupyProvider;
import net.siufung.market.base.permit.provider.UpdateMenuProvider;
import net.siufung.market.base.permit.service.IMenuService;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

/**
 * @author 陈建峰
 * @since 2022/5/16 2:44 下午
 */
@Configuration
@MapperScan({"net.siufung.market.base.permit.mapper"})
@AllArgsConstructor
public class MarketPermitAutoConfig {

    private final IMenuService menuService;
    private final IMenuMapper menuMapper;

    @Bean
    @Primary
    public IUpdateMenuSpi updateMenuProvider(){
        return new UpdateMenuProvider(menuService);
    }

    @Bean
    @Primary
    public ICheckMenuOccupySpi checkMenuOccupyProvider(){
        return new CheckMenuOccupyProvider(menuMapper);
    }

}
